package test;

import java.util.Scanner;

public class TriangleArea {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入三角形的底：");
        double base = scanner.nextDouble();
        System.out.print("请输入三角形的高：");
        double height = scanner.nextDouble();
        double area = calculateArea(base, height);
        System.out.println("三角形的面积为：" + area);
    }
    public static double calculateArea(double base, double height) {
        // 计算三角形面积的公式为：面积 = 0.5 * 底 * 高
        return 0.5 * base * height;
    }
}